﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.controllers.world {
    import net.wooga.pets.loading.vos.*;
    import net.wooga.pets.events.*;
    import net.wooga.pets.models.*;
    import net.wooga.pets.interfaces.*;
    import net.wooga.pets.constants.*;

    public class CreateNewDoctorCommand extends CreateActorCommand {

        public var gameStateModel:GameStateModel;

        override public function execute():void{
            var _local1:String = ((event.info.pet_type + "_") + event.info.workflow_state);
            var _local2:RequestEvent = new RequestEvent(EventConstants.SEND_REQUEST, this.onResult);
            _local2.addAssetRequest(ProtocolConstants.LOAD_DOCTOR, _local1.toLowerCase());
            dispatch(_local2);
        }
        private function onResult(_arg1:ResultVO):void{
            var _local2:ITreating = (worldFactory.createActor(event.info) as ITreating);
            setActor(_local2, EventConstants.CREATE_DOCTOR_VIEW);
            var _local3:Number = GameConstants.ACTORS_VISIBLE;
            if (((this.gameStateModel.isFacadeVisible) || (this.gameStateModel.isBuildMode))){
                _local3 = GameConstants.ACTORS_INVISIBLE;
            };
            dispatch(new InfoEvent(EventConstants.FADE_ACTOR, _local2.id, {visible:false, alpha:_local3, enabled:true}));
        }

    }
}//package net.wooga.pets.controllers.world 
